<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>成都博物馆内容管理平台</title>
    <link rel="stylesheet" href="../css/ext/bootstrap.min.css">
    <link rel="stylesheet" href="../css/common/base.css">
    <link rel="stylesheet" href="../css/recommend/recommend.css">
    <script src="../js/ext/jquery-1.11.3.js"></script>
    <script src="../js/ext/bootstrap.min.js"></script>
    <script src="../js/base.js"></script>
    <style>
        .l80{
            width: 90px;
        }
    </style>
</head>
<body>
<% include ../common/header.jsp %>
<div class="main">
    <% include ../common/menu.jsp %>
    <div class="main-content">
        <div class="wrapper">
            <div class="content-title">
                <!--面包屑-->
                <ol class="breadcrumb">
                    <li>首页管理</li>
                    <li class="active">视频框</li>
                </ol>
            </div><!--content-title-->
            <form action="" method="post">
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>名称</label>
                    <input id="name" class="i280" type="text" name="" maxlength="30">
                    <em>不超过30个字符，可由中英文数字及中英文符号组成</em>
                </div>
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>视频地址1</label>
                    <input id="video1" class="i340 video" type="text" name="" maxlength="32">
                    <em></em>
                </div>
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>视频地址2</label>
                    <input id="video2" class="i340 video" type="text" name="" maxlength="32">
                    <em></em>
                </div>
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>视频地址3</label>
                    <input id="video3" class="i340 video" type="text" name="" maxlength="32">
                    <em></em>
                </div>
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>视频地址4</label>
                    <input id="video4" class="i340 video" type="text" name="" maxlength="32">
                    <em></em>
                </div>
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>视频地址5</label>
                    <input id="video5" class="i340 video" type="text" name="" maxlength="20">
                    <em></em>
                </div>
                <div class="form-list textarea">
                    <label class="l80 pl16">备注</label>
                    <textarea id="remark" class="t594" name=""></textarea>
                    <em>不超过200个字符</em>
                </div>
                <div style="margin-left: 88px">
                    <input class="btn btn-submit" type="submit" value="提交">
                    <a class="btn btn-cancel" style="margin-left: 40px"><span>取消</span></a>
                </div>
            </form>
        </div><!--wrapper-->
        <div class="preview">
            <img class="img-responsive" src="../images/base/client-index.png" alt="">
        </div>
    </div><!--main-content-->
</div>
<script>
    $(function () {
        /**验证视频地址2345*/
        function check_video2(i) {
            var strRegex = "^[0-9]*$";
            var re = new RegExp(strRegex);
            var tar = $('.video').eq(i - 1);
            var str = $.trim(tar.val());
            if (str == '') {
                tar.parent().find('em').html('').show();
                return true
            } else {
                if (re.test(str) && str.length == 32) {
                    tar.parent().find('em').html('<i class="ic ic-right">').show();
                    return true
                } else {
                    tar.parent().find('em').html('<i class="ic ic-warn"></i>请填入正确的32位视频CODE').show();
                    return false
                }
            }
        }

        $('#name').blur(function () {
            check_name();
        });
        $('#video').blur(function () {
            check_video();
        });
        $('#video2').blur(function () {
            check_video2(2);
        });
        $('#video3').blur(function () {
            check_video2(3);
        });
        $('#video4').blur(function () {
            check_video2(4);
        });
        $('#video5').blur(function () {
            check_video2(5);
        });

        /*提交时验证*/
        $(document).submit(function () {
            var mark = 0;
            if (check_name())mark++;
            if (check_video())mark++;
            if (check_video2(2))mark++;
            if (check_video2(3))mark++;
            if (check_video2(4))mark++;
            if (check_video2(5))mark++;
            if (check_remark())mark++;
            if (mark == 7) {
                $('.btn-submit').val('提交中...').attr('disabled',true);
                setTimeout("$('.btn-submit').val('提交').attr('disabled',false)",300);
                return false;
            } else {
                return false;
            }
        })
    })
</script>
</body>
</html>